package com.hdu.xxlJobLocalCacheFix.config;

import com.github.benmanes.caffeine.cache.Cache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

import static com.github.benmanes.caffeine.cache.Caffeine.*;

@Configuration
public class CacheConfig {

    @Bean
    public Cache<String, String> id2nameCache() {
        return newBuilder()
                .maximumSize(1000)
                .expireAfterWrite(5, TimeUnit.HOURS)
                .build();
    }

}
